package com.example.demo.business.impl;

import com.example.demo.annotation.DistributedLock;
import com.example.demo.business.UserInfoBusiness;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class UserInfoBusinessImpl implements UserInfoBusiness {
    @Override
    @DistributedLock(key = "#id + #orderId")
    public String concurrencyCall(Integer id, String orderId) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.error("", e);
        }
        return orderId + ", OK";
    }
}
